package com.du.dupload;

import java.util.List;

public class URLDownloader implements IResourceDownloader {

	private static final String OUT = AppConfig.getInstance().getOutDir();
	private String torrentPath;
	private URLdownloadBytes downloader;
	
	URLDownloader(String torrentPath) {
		super();
		this.torrentPath = torrentPath;
	}

	@Override
	public float getProgressPercent() {
		return downloader.getProgress();
	}

	@Override
	public void close() {

	}

	@Override
	public void startDownload() {
		
		downloader.download();

	}

	@Override
	public boolean isCompleted() {
		return downloader.isFinished();
	}

	@Override
	public boolean isError() {
		return downloader.isError();
	}

	@Override
	public void stopDownload() {
		downloader.cancel();
	}

	@Override
	public void initializeLoading() {
		downloader = new URLdownloadBytes(torrentPath);
	}

	@Override
	public List<String> getPath() {
		
		return downloader.getResult();
	}

	

	@Override
	public String getName() {
		return downloader.getName();
	}

}
